﻿#if NET6_0_OR_GREATER


using zijian666;
using zijian666.Convertor.Extra;
using zijian666.Factory;

namespace NUnitTest;

public class UnitTest7
{


    [Test]
    public void TimeOnlyTest()
    {
        Assert.AreEqual(TimeOnly.Parse("16:50:02"), "2018-02-20 16:50:02".To<TimeOnly>());
        Assert.AreEqual(TimeOnly.Parse("16:50:02"), "16:50:02".To<TimeOnly>());
        Assert.AreEqual(TimeOnly.Parse("16:50:02"), "2018-02-20 16:50:02".To<DateTime>().To<int>().To<TimeOnly>());
    }

    [Test]
    public void DateOnlyTest()
    {
        Assert.AreEqual(DateOnly.Parse("2018-02-20"), "2018-02-20 16:50:02".To<DateOnly>());
        Assert.AreEqual(DateOnly.Parse("2018-02-20"), "2018-02-20".To<DateOnly>());
        Assert.AreEqual(DateOnly.Parse("2018-02-20"), DateOnly.FromDateTime("2018-02-20 16:50:02".To<DateTime>()).DayNumber.To<DateOnly>());
        Assert.AreEqual(DateOnly.Parse("2018-02-20").DayNumber, "2018-02-20".To<DateOnly>().DayNumber);
        Assert.AreEqual(123, 123.To<DateOnly>().DayNumber);
    }


}
#endif